package com.webproject.dao.impl.sysManager;

import java.util.List;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.webproject.core.Page;
import com.webproject.dao.sysManager.RoleManagerDao;
import com.webproject.entity.sysManager.Role;
import com.webproject.entity.sysManager.RoleMenuRelation;

public class RoleManagerDaoImpl extends SqlMapClientDaoSupport implements RoleManagerDao {

	@Override
	public List<Role> queryRoles(Page page) {
		// TODO Auto-generated method stub
		return getSqlMapClientTemplate().queryForList("RoleManager.queryRoles",page);
	}

	@Override
	public void saveRole(Role role) {
		// TODO Auto-generated method stub
		getSqlMapClientTemplate().insert("RoleManager.saveRole", role);
	}

	@Override
	public void updateRole(Role role) {
		// TODO Auto-generated method stub
		getSqlMapClientTemplate().update("RoleManager.updateRole", role);
	}

	@Override
	public void delRole(Role role) {
		// TODO Auto-generated method stub
		getSqlMapClientTemplate().delete("RoleManager.delRole", role);
	}

	@Override
	public int queryRolesCount(Page page) {
		// TODO Auto-generated method stub
		return (Integer) getSqlMapClientTemplate().queryForObject("RoleManager.queryRolesCount", page);
	}

	@Override
	public void saveRoleMenuRelation(RoleMenuRelation relation) {
		// TODO Auto-generated method stub
		getSqlMapClientTemplate().insert("RoleManager.saveRoleMenuRelation", relation);
	}

	@Override
	public void delRoleMenuRelation(RoleMenuRelation relation) {
		// TODO Auto-generated method stub
		getSqlMapClientTemplate().insert("RoleManager.delRoleMenuRelation", relation);
	}

}
